package com.scheduled.lesson.springbootscheduledasync;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@SpringBootApplication
@EnableScheduling
@EnableAsync
public class SpringbootScheduledAsyncApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootScheduledAsyncApplication.class, args);
    }

     @Bean("myTaskExecutor")
     public Executor myTaskExecutor() {
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();

         return executor;
     }

}
